Quantitative microbiology with widefield microscopy: navigating optical artefacts for accurate interpretations

Time-resolved live-cell imaging using widefield microscopy is instrumental in quantitative microbiology research. It allows researchers to track and measure the size, shape, and content of individual microbial cells over time. However, the small size of microbial cells poses a significant challenge in interpreting image data, as their dimensions approache that of the microscope’s depth of field, and they begin to experience significant diffraction effects. As a result, 2D widefield images of microbial cells contain projected 3D information, blurred by the 3D point spread function. In this study, we employed simulations and targeted experiments to investigate the impact of diffraction and projection on our ability to quantify the size and content of microbial cells from 2D microscopic images. This study points to some new and often unconsidered artefacts resulting from the interplay of projection and diffraction effects, within the context of quantitative microbiology. These artefacts introduce substantial errors and biases in size, fluorescence quantification, and even single-molecule counting, making the elimination of these errors a complex task. Awareness of these artefacts is crucial for designing strategies to accurately interpret micrographs of microbes. To address this, we present new experimental designs and machine learning-based analysis methods that account for these effects, resulting in accurate quantification of microbiological processes.


Figure S4:
Trendlines from synthetic data show that the ratio of estimated width and true width is dependent on the cell width for both membrane labelled cells (left), and for cytoplasm stained cells (right).The error grows rapidly for narrow cells and for cells with widths below 600 nm, the membrane stain method fails to work.The depth of field (DoF) = 0 lines show that without projection, the effects of diffraction and cell-width dependence of the results are mitigated for membrane stained cells.However, DoF=0 increases the error for cytoplasmically labelled cells.The estimated widths of cytoplasmically stained cells are calculated by taking the full width half maximum (FWHM) of the radial profile of the intensity, whereas for membrane stained cells the interpeak distance is taken.
Supplementary Information 5: The problem of thresholding cytoplasm images Thresholding cytoplasmically fluorescent cells poses a problem.Unlike with membrane stained cells, there is no parameter such as interpeak distance which can be quantified without bias.An image like this is blurred, and the blurring profile is imaging system dependent.Drawing a threshold around a blurred image is subject to bias, from the imaging wavelength, imaging system, and the thresholding method.Supplementary Information 10: Benchmarking performance of pretrained and retrained omnipose on experimental image data Benchmarking deep learning models on microscope data presents inherent challenges due to the absence of accurate ground truth.The point spread function inherently blurs the image, making it impractical for human annotators to draw accurate masks around objects.Consequently, while it may be relatively straightforward to assess the performance of deep learning models on synthetic test data, given the availability of perfect ground truth, evaluating their performance on real data poses greater difficulty, as perfect ground truth is lacking.
To tackle this challenge, we devised an experiment aimed at benchmarking the performance of segmentation models on real data, extracting the ground truth properties of cells from experimental images.Our method involves culturing dense populations of cells on agarose pads, leading to the formation of instantaneous cell clusters, which we term "preformed colonies."Importantly, the properties of individual cells within these colonies mirror the distribution observed in the original culture, regardless of whether they are clustered or isolated on the pad.Moreover, since bacterial cell width is tightly regulated, we can reasonably assume that the width distribution remains consistent across cells within clusters of varying sizes.By accurately measuring the mean width of cells from aligned patches within these clusters, as illustrated in Fig. S10 below, we can retrieve the ground truth cell width, and effectively benchmark the performance of deep learning segmentation algorithms trained on diverse training data.
Images of preformed bacterial colonies were captured following the protocol outlined in the methods section.We identified clusters containing five or more cells arranged side by side.We infer that this cellular arrangement results from cells pushing on and aligning with one another during colony formation, facilitated by the placement of the coverslip onto the agar pad and spreading of the droplet.Thus, we assume physical contact between these cells.Given the tightly controlled width of E. coli, we can estimate the true mean and standard deviation of cell width by measuring the total width of several patches and dividing by the number of cells within each patch.Subsequently, we manually retrieved stacks of cells from both SyMBac-trained and pretrained Omnipose models.The widths of these stacks were measured, and the width of a single cell was estimated by calculating the mean cell width across each patch and then aggregating the grand mean across all patches.We observed nearly identical mean and standard deviations (see Table S1).
Subsequently, we conducted a comparison between the performance of the Omnipose (bact_fluor_omni) model trained using human-annotated data (pretrained) and the same model retrained with synthetic training data generated by SyMBac (retrained).Example fields of view of the test data, along with their associated segmentation outputs, are presented in Fig. S11.These examples illustrate that the output of the pretrained omnipose model exhibits variability between cells, depending on whether they are isolated or part of clusters, as well as their position within the cluster.In contrast, the retrained Omnipose model demonstrates robust performance, aligning closely with the predictions from the benchmarking analysis conducted on synthetic test data.The mean cell widths obtained from the retrained omnipose model (0.94 ± 0.062 μm) closely correspond to the estimates derived from the patch analysis (0.94 ± 0.064 μm), whereas the output of the original omnipose model tends to overestimate cell width with notable variability (see Table S2).This loss function will be large even for differences in small values, which is useful for fitting PSFs, where the magnitude of the values spans 3 or more orders of magnitude.Therefore, the fit of the tails is maintained using this loss function.
. Therefore we can define the expected number of molecules observed as a function of the total number of molecules within the cell as a function of the density distribution of the molecules weighted by the detection probability: (Noting that here, is a shifted version for the purposes of integrating between and . Therefore, using this scheme, is a constant for a given cell geometry.This can be used to correct for the number of molecules lost to depth of field effects.This, however, will not correct for diffraction effects, and is therefore most useful at low molecular counts or when the depth of the sample is large.Additionally, we can use this information to adjust the experimental setup by defocussing in order to maximise the detection probability in a given geometry.Take for instance, a focal offset of , the maximum detection probability can be found by shifting the detection probability curve (assuming the objective moves, and not the microscope stage), and solving: Therefore given an optimal value of , and accurate modelling of the cell's geometry, one can correct for detection loss due to signal loss.It should be noted that correction factor applies to the average molecular count.Thus single cell size estimation cannot be corrected for by deconvolution.

Figure S5 :
Figure S5: The quality of output masks from various thresholding algorithms are compared.A 1 μm wide, 3 μm long synthetic cytoplasmically fluorescent cell is simulated under various emission wavelengths (1.49NA, 1.51 refractive index), and thresholded with common global thresholding techniques.Most thresholding algorithms show inaccurate and wavelength dependent performance, except isodata and otsu.

Figure S6 :
Figure S6: Example phase-contrast images of the same cells collected with different emission filters (blue -435 nm and red 595 nm).Images formed using the lower wavelength light are sharper and produce narrower cross sections (as seen from the corresponding radial intensity profiles), while images from longer wavelength are washed out due to diffraction effects.Note the flatness of the minima of the blue light profiles in comparison to the red light profiles.This is likely due to the narrower z-profile of the transmitted phase contrast PSF under blue light conditions (effectively resulting in less contribution from projected planes and more from the central plane).

Figure
Figure S10: left) An example field of view from the segmented data, with patches of aligned cells zoomed.right) 12 patches were analysed (6 shown), for a total of 66 cells.Their overall width is estimated along the red line.We took the width to be the average of a 4 pixel wide line, to minimise small pixelation artefacts at the edges of cells arising from rotation without pixel interpolation.(Scale bar = 1 μm)

FigureFigure S21 :
Figure S14: a) The instrumental (i)PSF, theoretical (t)PSF, and effective (e)PSFs are all shown in the xz plane.The tPSF and ePSF are both fitted to the iPSF according to the aforementioned method.The dotted line shows the location of the drawn intensity profile in panel b.b) The tPSF can be fitted to the iPSF, however for simulation of very long range optical effects, such as diffraction over a long distance within a microcolony, the iPSF would have to be measured with very high SNR up to ranges of more than tens of microns.This would require an extremely large number of very highly separated beads to be imaged and averaged.Additionally, the magnitude of the PSF's intensity may vary over more than 4-5 orders of magnitude as the domain expands, making capturing the entire PSF's range impossible within the values of the 16-bit unsigned integer type, which many microscope cameras use.Therefore we attempted to extrapolate the domain of the tPSF to simulate long range effects.This showed that the theoretical PSF (tPSF) was not a good fit to the iPSF compared to the optimised ePSF function.With ePSF domain extrapolation, one can generate a PSF of any size, and use 64-bits of floating point precision for convolution.However, we note here that the ePSF still under-estimates the long range effects that we measured our iPSF to have at ~5 μm from the centre.

Figure S23 :
Figure S23: Showing the difference between naive 2D convolution vs 3D convolution + projection in both membrane and cytoplasmically fluorescent cells.The resultant images can be markedly different.Only correct deconvolution of the first image would be possible, as it is the direct inverse of the operation which created it.Deconvolution of the projected image is impossible since information is lost in the layer summation process.

Table S1 :
True mean and standard deviation of the width of cells from models.Average between models is taken to be the ground truth.Determining the true mean cell width from patches is not dependent on the model selection, since we chose patches of cells which are tightly packed and space filling, thus masks for cells within the patch necessarily must

Table S2 :
Retraining on bespoke synthetic data tailored to the experiment brings the width estimates and standard deviations to well within bounds of the estimated true mean.The retrained model shows higher precision (lower standard deviation) compared to the pretrained model.